import request from '@/utils/request'

interface ArticleParams {
  pageCurrent: number
  pageSize: number
}

interface ArticleData {
  articleId?: number
  title: string
  content: string
  author?: string
  publishTime?: string
  state?: number
  sort?: number
  articleType?: number
}

// 获取文章列表
export function getArticleList(params: ArticleParams) {
  return request({
    url: '/app/article/list',
    method: 'get',
    params
  })
}

// 获取文章详情
export function getArticleDetail(id: number) {
  return request({
    url: `/app/article/${id}`,
    method: 'get'
  })
}

// 新增文章
export function addArticle(data: ArticleData) {
  return request({
    url: '/app/article',
    method: 'post',
    data
  })
}

// 修改文章
export function updateArticle(data: ArticleData) {
  return request({
    url: '/app/article',
    method: 'put',
    data
  })
}

// 删除文章
export function deleteArticle(id: number) {
  return request({
    url: `/app/article/${id}`,
    method: 'delete'
  })
} 